﻿namespace Anurgath.Shoutbox.Handlers
{
    #region Usings
    using Anurgath.Shoutbox.Models;
    using Anurgath.Shoutbox.Services;
    using Orchard.ContentManagement.Handlers;
    using Orchard.Data;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    #endregion

    public class ShoutboxHandler : ContentHandler
    {
        #region Constructors
        public ShoutboxHandler(IRepository<ShoutboxPartRecord> repository, IPostService postService)
        {
            Filters.Add(StorageFilter.For(repository));

            OnActivated<ShoutboxPart>((context, part) =>
            {
                part.Posts = postService.GetAllPostsForShoutbox(part.Id);
            });
        }
        #endregion
    }
}